/*
 * Copyright © 2018 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

@import '../../../styles/variables.scss';
$switch-btn-width: 14px;
$widget-height: 32px;
$switch-button-margin-top: 2px;
$on-color: $blue-02;
$off-color: $grey-04;

.toggle-switch-container {
  display: inline-block;
  max-width: 100%;

  .toggle-switch {
    vertical-align: middle;
    border-radius: 5px;
    font-weight: 500;
    color: white;
    user-select: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    padding: 2px;

    .switch-button {
      min-width: $switch-btn-width;
      height: $widget-height - ($switch-button-margin-top * 2);
      background-color: white;
      border-radius: 5px;
    }

    .label {
      height: 100%;
      font-size: 11px;
      padding: 0 8px;
    }

    &.on {
      background-color: $on-color;
    }

    &.off {
      background-color: $off-color;
      flex-direction: row-reverse;
    }
  }

  &.disabled {
    cursor: not-allowed;

    .toggle-switch {
      pointer-events: none;
      opacity: 0.5;
    }
  }
}
